package com.kye.express.utils;

import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;

/**
 * @author : Joe
 * @version : 1.0
 * @editor : Joe
 * @created : 20/12/2017
 * @updated : 20/12/2017
 * @description : <Description>
 * @update_reason : <UpdateReason>
 *     简单封装
 */

public class DialogUtils {

    public static DialogFragment show(DialogFragment dialogFragment, FragmentManager fragmentManager, String tag) {
        if (dialogFragment != null && dialogFragment.getDialog() != null
                && dialogFragment.getDialog().isShowing()) {
            //dialog is showing
        }
        if (dialogFragment != null) {
            dialogFragment.show(fragmentManager, tag);
        }
        return dialogFragment;
    }

    public static void dimiss(DialogFragment dialogFragment) {
        if (dialogFragment != null && dialogFragment.getDialog() != null
                && dialogFragment.getDialog().isShowing()) {
            //dialog is showing
            dialogFragment.dismiss();
        }
    }
}
